/*
 * @Author: chen17
 * @Date: 2022-03-30 11:45:06
 * @LastEditTime: 2023-11-20 13:00:14
 * @Description: 后台配置
 */

import defaultSettings from '@/config'

const { title, fixedHeader, showTabs, showTabsIcon } = defaultSettings

const state = {
    title: title,
    fixedHeader: fixedHeader,
    showTabs: showTabs,
    showTabsIcon: showTabsIcon
}

const mutations = {
    CHANGE_SETTING: (state, { key, value }) => {
        if (state.hasOwnProperty(key)) {
            state[key] = value
        }
    }
}

const actions = {
    changeSetting({ commit }, data) {
        commit('CHANGE_SETTING', data)
    }
}

export default {
    namespaced: true,
    state,
    mutations,
    actions
}
